Skip to content

Feat/js ant simulation core - #3

Open
5pence5 wants to merge 5 commits into
SebLague:mainfrom
5pence5:feat/js-ant-simulation-core
Open

Feat/js ant simulation core#3
5pence5 wants to merge 5 commits into
SebLague:mainfrom
5pence5:feat/js-ant-simulation-core

Conversation

@5pence5

@5pence5 5pence5 commented May 22, 2025

Copy link
Copy Markdown

No description provided.

5pence5 and others added 5 commits May 21, 2025 15:32
…th-setup-script

Add JS port plan and setup script
This commit includes the initial JavaScript port of the Unity ant simulation.

Key functionalities implemented:
- HTML setup with a canvas for rendering.
- Core simulation classes:
    - AntSettings: Manages simulation parameters.
    - Vector2: Handles 2D vector operations.
    - PerceptionMap: Manages pheromone creation, storage, and lookup with decay.
    - FoodSource: Spawns and manages food items with clustered, seedable random distribution.
    - Ant: Controls individual ant behavior including states (searching, returning), movement, steering, food collection, and pheromone interaction.
    - AntColony: Manages the ant population, spawning, and interfaces with perception maps.
- Rendering:
    - Renderer class draws the colony, ants (oriented and colored by state), food items, and pheromone trails (home and food) on the canvas.
- Main simulation loop:
    - Initializes all components.
    - Runs the update and render cycle using requestAnimationFrame.

Current state:
The simulation is visually functional. Ants navigate, interact with food and pheromones.
Collision detection (ant-ant, ant-obstacle) is the next major feature planned and is not yet implemented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant